package org.codeCard.control;


import org.codeCard.bean.SearchSaleCardResultBean;
import org.codeCard.frame.CodeCardJFrame;
import org.codeCard.panel.CodeCardJPanel;
import org.codeCard.panel.CodeCardSaleJPanel;
import org.codeCard.util.CodeCardUntil;
import org.come.action.FromServerAction;
import org.come.until.GsonUtil;

public class SaleCardMySearchControl implements FromServerAction {
    @Override
    public void controlMessFromServer(String mes, String type) {
        // 消息处理部分
        SearchSaleCardResultBean sa = GsonUtil.getGsonUtil().getgson().fromJson(mes, SearchSaleCardResultBean.class);


        CodeCardJPanel bjczCardJpanel = CodeCardJFrame.getBjczMainJpanel().getBjczCardJpanel();
        CodeCardSaleJPanel codeCardSaleJPanel = bjczCardJpanel.getBjcz2Jpanel();
        CodeCardUntil.setSellerTableModel(codeCardSaleJPanel.getjScrollPane(), sa.getSaleCardOrders());

        codeCardSaleJPanel.setPage(
                sa.getTotal() == 0 ? 1 : sa.getTotal());

        CodeCardJFrame.bjczMainJpanel.getBjczCardJpanel().getCardLayout().
                show(CodeCardJFrame.bjczMainJpanel.getBjczCardJpanel(), "bjcz2Jpanel");
    }
}
